import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;


public class UrlCheck {
	public void checkUrl(URI uri) throws IOException{
		URL u = new URL ( "http://www.example.com/");
		HttpURLConnection huc =  ( HttpURLConnection )  u.openConnection (); 
		huc.setRequestMethod ("GET");  //OR  huc.setRequestMethod ("HEAD"); 
		huc.connect () ; 
		int code = huc.getResponseCode() ;
		System.out.println(code);
	}

}
//try {
//    URI uri = new URI(name);
//
//    // perform checks for scheme, authority, host, etc., based on your requirements
//
//    if ("mailto".equals(uri.getScheme()) {...]
//    if (uri.getHost() == null) {...}
//
//} catch (URISyntaxException e) {
//}